package com.salelogistics.basic.service.impl;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;

import com.salelogistics.common.core.utils.DateUtils;
import com.salelogistics.common.core.utils.StringUtils;
import com.salelogistics.system.api.domain.SysDept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.salelogistics.basic.mapper.BasMaterialMapper;
import com.salelogistics.basic.domain.BasMaterial;
import com.salelogistics.basic.service.IBasMaterialService;

/**
 * 材料Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-07-10
 */
@Service
public class BasMaterialServiceImpl implements IBasMaterialService 
{
    @Autowired
    private BasMaterialMapper basMaterialMapper;

    /**
     * 查询材料
     * 
     * @param materialId 材料主键
     * @return 材料
     */
    @Override
    public BasMaterial selectBasMaterialByMaterialId(Long materialId)
    {
        return basMaterialMapper.selectBasMaterialByMaterialId(materialId);
    }

    /**
     * 查询材料列表
     * 
     * @param basMaterial 材料
     * @return 材料
     */
    @Override
    public List<BasMaterial> selectBasMaterialList(BasMaterial basMaterial)
    {
        return basMaterialMapper.selectBasMaterialList(basMaterial);
    }


    /**
     * 新增材料
     * 
     * @param basMaterial 材料
     * @return 结果
     */
    @Override
    public int insertBasMaterial(BasMaterial basMaterial)
    {
        basMaterial.setCreateTime(DateUtils.getNowDate());
        return basMaterialMapper.insertBasMaterial(basMaterial);
    }

    /**
     * 修改材料
     * 
     * @param basMaterial 材料
     * @return 结果
     */
    @Override
    public int updateBasMaterial(BasMaterial basMaterial)
    {
        return basMaterialMapper.updateBasMaterial(basMaterial);
    }

    /**
     * 批量删除材料
     * 
     * @param materialIds 需要删除的材料主键
     * @return 结果
     */
    @Override
    public int deleteBasMaterialByMaterialIds(Long[] materialIds)
    {
        return basMaterialMapper.deleteBasMaterialByMaterialIds(materialIds);
    }

    /**
     * 删除材料信息
     * 
     * @param materialId 材料主键
     * @return 结果
     */
    @Override
    public int deleteBasMaterialByMaterialId(Long materialId)
    {
        return basMaterialMapper.deleteBasMaterialByMaterialId(materialId);
    }

    @Override
    public int updateMaterialStatus(BasMaterial basMaterial) {
        return basMaterialMapper.updateMaterialStatus(basMaterial);
    }

    @Override
    public List<BasMaterial> selectBasMaterialParentList(Long typeId) {
        return basMaterialMapper.selectBasMaterialParentList(typeId);
    }
}
